{include file="public/header" /}
<style>
    @media (max-width: 375px) {
        .edit-form tr td input{width:100%;}
        .edit-form tr th:first-child,.edit-form tr td:first-child{
            width:20%;
        }
        .edit-form tr th:nth-last-of-type(-n+2),.edit-form tr td:nth-last-of-type(-n+2){
            display: none;
        }
    }
    .edit-form table > tbody > tr td a.btn-delcfg{
        visibility: hidden;
    }
    .edit-form table > tbody > tr:hover td a.btn-delcfg{
        visibility: visible;
    }
</style>
<body class="gray-bg">
<div class="animated fadeIn">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>系统配置</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="tabs_panels.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="tabs_panels.html#">选项1</a>
                            </li>
                            <li><a href="tabs_panels.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="panel blank-panel">

                                <div class="panel-heading">
                                    <div class="panel-options">

                                        <ul class="nav nav-tabs">
                                            {volist name='siteList' id='vo'}
                                            <li class="{$vo.active?'active':''}">
                                                <a data-toggle="tab" href="#{$vo.name}" aria-expanded="true">
                                                    {$vo.title}
                                                </a>
                                            </li>
                                            {/volist}

                                            <li class=""><a data-toggle="tab" href="tabs_panels.html#tab-7" aria-expanded="false"><i class="fa fa-plus"></i></a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>

                                <div class="panel-body">
                                    <div class="tab-content">
                                        {volist name='siteList' id='vo'}
                                        <div class="tab-pane fade {$vo.active ? 'active in' : ''}" id="{$vo.name}">
                                            <div class="widget-body no-padding">
                                                <form id="{$vo.name}-form" class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('config/edit')}">
                                                    <table class="table table-striped">
                                                        <thead>
                                                            <tr>
                                                                <th width="15%">变量标题</th>
                                                                <th width="68%">变量值</th>
                                                                <th width="15%">变量名</th>
                                                                <th width="2%"></th>
                                                            </tr>
                                                        </thead>
                                                    <tbody>
                                                    {foreach $vo.list as $item}
                                                    <tr>
                                                        <td>{$item.title}</td>
                                                        <td>
                                                        <div class="row">
                                                        <div class="col-sm-8 col-xs-12">
                                                        {switch $item.type}
                                                            {case string}
                                                                <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}" />
                                                            {/case}
                                                            {case text}
                                                                <textarea {$item.extend} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}
                                                                </textarea>
                                                            {/case}
                                                            {case array}
                                                            <dl class="fieldlist" data-name="row[{$item.name}]">
                                                                <dd>
                                                                    <ins>键名</ins>
                                                                    <ins>键值</ins>
                                                                </dd>
                                                                <dd>
                                                                    <a href="javascript:;" class="btn btn-sm btn-success btn-append">
                                                                        <i class="fa fa-plus"></i> 追加
                                                                    </a>
                                                                </dd>
                                                                <textarea name="row[{$item.name}]" class="form-control hide" cols="30" rows="5">{$item.value|htmlentities}</textarea>
                                                            </dl>
                                                            {/case}
                                                            {case number}
                                                                <input {$item.extend} type="number" name="row[{$item.name}]" value="{$item.value}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}" />
                                                            {/case}
                                                            {case checkbox}
                                                            {foreach name="item.content" item="vo"}
                                                            <div class="radio i-checks col-sm-2">

                                                            <label for="row[{$item.name}][]-{$key}"><input id="row[{$item.name}][]-{$key}" name="row[{$item.name}][]" type="checkbox" value="{$key}" data-tip="{$item.tip}" {in name="key" value="$item.value"}checked{/in} /> {$vo}</label>
                                                            </div>
                                                            {/foreach}
                                                            {/case}
                                                            {case radio}
                                                            {foreach name="item.content" item="vo"}
                                                            <div class="radio i-checks col-sm-2">
                                                            <label for="row[{$item.name}]-{$key}">
                                                                <input id="row[{$item.name}]-{$key}" name="row[{$item.name}]" type="radio" value="{$key}" data-tip="{$item.tip}" {in name="key" value="$item.value"}checked{/in} />
                                                                {$vo}
                                                            </label>
                                                            </div>
                                                            {/foreach}
                                                            {/case}
                                                            {case value="select" break="0"}{/case}
                                                            {case value="selects"}
                                                            <select {$item.extend} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
                                                                {foreach name="item.content" item="vo"}
                                                                <option value="{$key}" {in name="key" value="$item.value"}selected{/in}>{$vo}</option>
                                                                {/foreach}
                                                            </select>
                                                            {/case}
                                                            {case value="image" break="0"}{/case}
                                                            {case value="images"}
                                                            <div class="form-inline">
                                                                <input id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
                                                                <span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='image'?'false':'true'}" data-preview-id="p-{$item.name}"><i class="fa fa-upload"></i> 上传</button></span>
                                                                <span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='image'?'false':'true'}"><i class="fa fa-list"></i> 选择</button></span>
                                                                <span class="msg-box n-right" for="c-{$item.name}"></span>
                                                                <ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul>
                                                            </div>
                                                            {/case}
                                                            {case value="file" break="0"}{/case}
                                                            {case value="files"}
                                                            <div class="form-inline">
                                                                <input id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
                                                                <span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}"><i class="fa fa-upload"></i> 上传</button></span>
                                                                <span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}"><i class="fa fa-list"></i> 选择</button></span>
                                                                <span class="msg-box n-right" for="c-{$item.name}"></span>
                                                            </div>
                                                            {/case}
                                                            {case switch}
                                                            <div class="radio ">
                                                                <input type="checkbox" name='row[{$item.name}]' value="{:$item.value?1:0}" class="js-switch" {if condition="$item.value eq 1"}checked{/if}/>
                                                            </div>
                                                            {/case}
                                                            {case bool}
                                                            <label for="row[{$item.name}]-yes"><input id="row[{$item.name}]-yes" name="row[{$item.name}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip}" /> {:__('Yes')}</label>
                                                            <label for="row[{$item.name}]-no"><input id="row[{$item.name}]-no" name="row[{$item.name}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip}" /> {:__('No')}</label>
                                                            {/case}

                                                        {/switch}
                                                        </div>
                                                        <div class="col-sm-4"></div>
                                                        </div>

                                                        </td>
                                                        <td>
                                                        {php}
                                                            echo "{\$site.". $item['name'] . "}";
                                                            {/php}
                                                        </td>
                                                        <td>
                                                        <button type="button" class="btn btn-danger addel-delete">
                                                        <i class="fa fa-remove"></i>
                                                        </button>
                                                        </td>
                                                        </tr>
                                                        {/foreach}
                                                        </tbody>
                                                        <tfoot>
                                                        <tr>
                                                        <td></td>
                                                        <td>
                                                        <button type="submit" class="btn btn-primary btn-embossed">提交</button>
                                                        <button type="reset" class="btn btn-default btn-embossed">取消</button>
                                                        </td>
                                                        <td></td>
                                                        <td></td>
                                                        </tr>
                                                    </tfoot>
                                                    </table>
                                                </form>
                                            </div>
                                        </div>
                                        {/volist}

                                        <div id="tab-7" class="tab-pane">
                                            <strong>栅格系统</strong>

                                            <p>Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统，随着屏幕或视口（viewport）尺寸的增加，系统会自动分为最多12列。它包含了易于使用的预定义类，还有强大的mixin 用于生成更具语义的布局。</p>
                                        </div>
                                    </div>

                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
{include file="public/footer" /}

</body>

</html>
